{template 'common/header'}
<div id="system-site-setting" ng-controller="systemSiteSettingCtrl" ng-cloak>
	<ul class="we7-page-tab">
		<li{if $do == 'basic'} class="active"{/if}><a href="{php echo url('system/site/basic');}">基本信息</a></li>
		<li{if $do == 'icps'} class="active"{/if}><a href="{php echo url('system/site/icps');}">ICP备案</a></li>
		
	</ul>
	<div class="clearfix">
		<div class="form-files-box">
			{if $do == 'basic'}
			<div>
				<!-- 基本设置 start -->
				<div class="form-files we7-margin-bottom">
					<div class="form-file header">基本设置</div>
					<!-- 站点开关 start -->
					<div class="form-file">
						<div class="form-label">关闭站点</div>
						<div class="form-value"></div>
						<div class="form-edit">
							<label>
								<div ng-class="settings.status == undefined || settings.status == 0 ? 'switch' : 'switch switchOn'"  ng-click="saveSettingSwitch('status', settings.status)"></div>
							</label>
						</div>
					</div>
					<!-- 站点开关 end -->

					<!-- 关闭原因 start -->
					<div class="form-file">
						<div class="form-label">关闭原因</div>
						<div class="form-value" ng-bind="settings.reason"></div>
						<div class="form-edit">
							<we7-modal-form label="'关闭原因'" on-confirm="saveSetting(formValue, 'reason', 'string')" value="settings['reason']"></we7-modal-form>
						</div>
					</div>
					<!-- 关闭原因 end -->

					<!-- 自动退出 start -->
					<div class="form-file">
						<div class="form-label">自动退出</div>
						<div class="form-value" ng-bind="settings.autosignout_notice"></div>
						<div class="form-edit">
							<a href="#autosignout" data-toggle="modal" data-target="#autosignout">修改</a>
						</div>
						<div class="modal fade modal-form" id="autosignout" role="dialog">
							<div class="we7-modal-dialog modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
										<div class="modal-title">设置自动退出时间</div>
									</div>
									<div class="modal-body we7-form">
										<div class="alert alert-info we7-page-alert">
											<p><i class="wi wi-info-sign"></i>登录状态下，若长时间无操作系统将自动退出。</p>
										</div>
										<div class="form-group" ng-init="autosignout = settings.autosignout; autosignoutCopy = autosignout">
											<input type="radio" id="autosignout1" value="30" ng-change="autosignoutCopy = autosignout" ng-model="autosignout">
											<label for="autosignout1">30分钟退出 <span class="active"></span></label>
											<input type="radio" id="autosignout2" ng-change="autosignoutCopy = autosignout" value="60" ng-model="autosignout" >
											<label for="autosignout2">1小时退出<span></span></label>
											<input type="radio" id="autosignout3" ng-change="autosignoutCopy = autosignout" value="180" ng-model="autosignout" >
											<label for="autosignout3">3小时退出<span></span></label>
											<input type="radio" id="autosignout4" ng-change="autosignoutCopy = autosignout" value="" ng-model="autosignout" ng-checked="autosignout != 30 && autosignout != 60 && autosignout != 180">
											<label for="autosignout4">自行设置<span></span></label>
										</div>
										<div class="form-group marbot0" ng-show="autosignout != 30 && autosignout != 60 && autosignout != 180">
											<!-- <label class="col-sm-2 co	ntrol-label">备案号</label> -->
											<div class="input-group" >
												<input type="text" ng-model="autosignoutCopy" class="form-control" placeholder="自动退出时间" autocomplete="off" >
												<span class="input-group-addon">
													分钟
												</span>
											</div>
										</div>
									</div>
									<div class="modal-footer">
										<button type="button" class="btn btn-primary" ng-click="saveSetting({value: autosignoutCopy}, 'autosignout', 'int')" data-dismiss="modal">确定</button>
										<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- 自动退出 end -->

					<!-- 备案号 start -->
					<div class="form-file">
						<div class="form-label">联网备案信息</div>
						<div class="form-value">{$settings['policeicp']['policeicp_location']} {$settings['policeicp']['policeicp_code']}<span class="we7-margin-left">直接填写联网备案信息即可,系统已添加工信部链接</span></div>
						<div class="form-edit">
							<a href="#policeicp" data-toggle="modal" data-target="#policeicp">修改</a>
						</div>
					</div>
					<div class="modal fade modal-form" id="policeicp" role="dialog">
						<div class="we7-modal-dialog modal-dialog">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
									<div class="modal-title">联网备案信息</div>
								</div>
								<div class="modal-body we7-form">
									<div class="form-group">
										<label class="col-sm-2 control-label">备案地</label>
										<div class="col-sm-10">
											<input type="text" ng-model="policeicp.value.location" class="form-control" placeholder="例如：京公网安备"  autocomplete="off" >
										</div>
									</div>
									<div class="form-group marbot0">
										<label class="col-sm-2 control-label">备案号</label>
										<div class="col-sm-10">
											<input type="text" ng-model="policeicp.value.code" class="form-control" placeholder="例如：11000002000001" autocomplete="off" >
										</div>
									</div>
								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-primary" ng-click="saveSetting(policeicp, 'policeicp', 'string')" data-dismiss="modal">确定</button>
									<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
								</div>
							</div>
						</div>
					</div>
					<!-- 备案号 end -->

					<!-- 调试模式 start -->
					<div class="form-file">
						<div class="form-label">调试模式</div>
						<div class="form-value"></div>
						<div class="form-edit">
							<div ng-class="settings.develop_status == undefined || settings.develop_status == 0 ? 'switch' : 'switch switchOn'"  ng-click="saveSettingSwitch('develop_status', settings.develop_status)"></div>
						</div>
					</div>
					<!-- 调试模式 end -->

					<!-- 日志开关 start -->
					<div class="form-file">
						<div class="form-label">日志开关</div>
						<div class="form-value"></div>
						<div class="form-edit">
							<div ng-class="settings.log_status == undefined || settings.log_status == 0 ? 'switch' : 'switch switchOn'"  ng-click="saveSettingSwitch('log_status', settings.log_status)"></div>
						</div>
					</div>
					<!-- 日志开关 end -->

					<!-- 异地登录验证 start -->
					<div class="form-file">
						<div class="form-label">异地登录验证</div>
						<div class="form-value">{{'{$_W['user']['mobile']}' | mobile}}</div>
						<div class="form-edit">
							<div ng-class="settings.login_verify_status == undefined || settings.login_verify_status == 0 ? 'switch' : 'switch switchOn'" ng-click="saveSettingSwitch('login_verify_status', settings.login_verify_status, '{$_W['user']['mobile']}')"></div>
						</div>
						<div class="modal fade modal-form" id="login_verify" role="dialog">
							<div class="we7-modal-dialog modal-dialog modal-tip">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
									</div>
									<div class="modal-body ">
										<div class="text-center">
											<i class="text-info wi wi-info"></i>
											<p class="title">系统提示</p>
											<p class="content">您的账号还未绑定手机号，请先绑定手机号后，再开启此功能</p>
										</div>
									</div>
									<div class="modal-footer">
										<a href="{php echo url('user/profile', array('user_type' => 4));}" class="btn btn-primary" >前去设置</a>
										<button type="button" class="btn btn-default" data-dismiss="modal">确认</button>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- 异地登录验证 end -->
				</div>
				<!-- 基本设置 end -->

				<!-- 站点风格 start -->
				

					
					
				<!-- 站点风格 end -->
			</div>
			{/if}
			{if $do == 'icps'}
			<div class="search-box we7-margin-bottom">
				<form action="" method="get" class="search-form" role="form">
					<input type="hidden" name="c" value="system">
					<input type="hidden" name="a" value="site">
					<input type="hidden" name="do" value="icps">
					<div class="input-group col-sm-4 pull-left">
						<input class="form-control" name="keyword" placeholder="" id="" type="text" value="{$_GPC['keyword']}">
						<div class="input-group-btn">
							<button class="btn btn-default"><i class="fa fa-search"></i></button>
						</div>
					</div>
				</form>
				<a class="btn btn-primary we7-margin-left" ng-click="addIcps()">+添加</a>
			</div>
			<table class="table we7-table table-hover">
				<tr>
					<th style="width:150px;">域名地址</th>
					<th style="width:150px;">icp备案号</th>
					<th style="width:150px;">操作</th>
				</tr>
				<tr ng-repeat="(key, icp) in icps" ng-if="icps">
					<td ng-bind="icp.domain"></td>
					<td ng-bind="icp.icp"></td>
					<td>
						<div class="link-group">
							<a href="javascript:;" ng-click="editIcp(key)">修改</a>
							<we7-modal-tip on-confirm="deleteIcp(icp.id)" content="'确认删除当前选择的域名备案?'"><a href="javascript:;" >删除</a></we7-modal-tip>
						</div>
					</td>
				</tr>
			</table>
			<div class="we7-empty-block we7-margin-top" style="line-height: 20px;" ng-if="icps | we7IsEmpty" >
				<p  class="color-dark"><i class="wi wi-info color-default font-lg vertical-middle"></i>暂无添加的域名ICP备案号</p>
				<p>目前针对网站备案问题严查，需要根据域名显示不同的备案号，建议暂无备案的请及时完善信息。</p>
				<a class="color-default" href="javascript:;" ng-click="addIcps()">立即添加></a>
			</div>
			<div class="text-right">
				{$pager}
			</div>
			<div class="modal fade bs-example-modal-sm" id="add-icps" tabindex="-1" style="z-index:1039" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog we7-modal-dialog ">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
							<h4 class="modal-title">ICP/域名备案信息</h4>
						</div>
						<div class="modal-body overflow-auto">
							<form action="" method="post" name="icps_form" enctype="multipart/form-data" class="we7-form form" >
								<div class="icp-list ">
									<div class="icp-item" ng-repeat="(key, item) in domains_data track by $index" >
										<div class="form-box">
											<div class="form-group ">
												<label class="col-sm-2 control-label">域名</label>
												<div class="col-sm-10 ">
													<input type="text" name="{{'domains_data_' + $index}}" required min="0" ng-model="domains_data[$index]" class="form-control">
													<span class="help-block">
														请填写域名
													</span>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-2 control-label">备案号</label>
												<div class="col-sm-10">
													<input type="text" name="{{'icps_data' + $index}}" required  min="0" ng-model="icps_data[$index]" class="form-control">
													<span class="help-block">
														请填写备案号
													</span>
												</div>
											</div>
										</div>
										<a href="javascript:;" class="color-default delete" ng-if="$index != 0" ng-click="delIcps($index)">删除</a>
									</div>
								</div>
								<div class="row we7-margin-top">
									<div class="col-sm-2"></div>
									<div class="col-sm-10">
										<a href="javascript:;" class="color-default" ng-click="pulsIcps()">
											<i class="wi wi-plus"></i>添加
										</a>
									</div>
								</div>
							</form>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-primary" name="submit" value="保存" ng-disabled="icps_form.$pristine&&icps_form.$invalid " ng-click="saveIcps()">保存</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						</div>
					</div>
				</div>
			</div>
			<div class="modal fade bs-example-modal-sm" id="edit-icp" tabindex="-1" style="z-index:1039" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog we7-modal-dialog ">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
							<h4 class="modal-title">修改</h4>
						</div>
						<div class="modal-body">
							<form action="" method="post" name="icps_edit" enctype="multipart/form-data" class="we7-form form" >
								<div class="icp-list ">
									<div class="icp-item">
										<div class="form-box">
											<div class="form-group">
												<label class="col-sm-2 control-label">域名</label>
												<div class="col-sm-10">
													<input type="text" name="domain" required min="0" ng-model="currentIcp.domain" class="form-control">
													<span class="help-block">
														请填写域名
													</span>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-2 control-label">备案号</label>
												<div class="col-sm-10">
													<input type="text"  min="0" name="icp" required ng-model="currentIcp.icp" class="form-control">
													<span class="help-block">
														请填写备案号
													</span>
												</div>
											</div>
										</div>
									</div>
								</div>
							</form>
						</div>

						<div class="modal-footer">
							<button type="button" class="btn btn-primary" name="submit" value="保存" ng-click="updateIcp()">保存</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						</div>
					</div>
				</div>
			</div>
			{/if}
			{if $do == 'copyright'}
				
			{/if}

			{if $do == 'about'}
				
			{/if}
		</div>
	</div>
</div>

<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=F51571495f717ff1194de02366bb8da9&s=1"></script>
<script type="text/javascript">
	$("input[name='status']").click(function() {
		if ($(this).val() == 1) {
			$(".reason").show();
			var reason = $("input[name='reasons']").val();
			$("textarea[name='reason']").text(reason);
		} else {
			$(".reason").hide();
		}
	});
	$("input[name='mobile_status']").click(function() {
		if ($(this).val() == 0) {
			$("#login_type_status-1").attr("checked", false);
			$("#login_type_status-0").prop("checked", true);
			$("#login_type_status-1").attr("disabled", true);
		} else {
			$("#login_type_status-1").attr("disabled", false);
		}
	});
</script>

<script>
	angular.module('systemApp').value('config', {
		'settings' : {php echo json_encode($settings)},
		'template' : {php echo json_encode($template)},
		'template_ch_name' : {php echo json_encode($template_ch_name)},
		'login_ch_name' : {php echo json_encode($login_ch_name)},
		'icps': {php echo json_encode($icps)},
		links: {
			'saveSettingUrl' : "{php echo url('system/site/save_setting')}",
			'saveIcpsUrl': "{php echo url('system/site/save_icps')}",
			'editIcpUrl': "{php echo url('system/site/edit_icp')}",
			'delIcpUrl': "{php echo url('system/site/del_icp')}",
		}

	});
	angular.bootstrap($('#system-site-setting'), ['systemApp']);
</script>
{template 'common/footer'}